AI Lessons
Lesson 26: System prompts and roles

Purpose: To understand how system prompts and message roles shape an LLM's behaviour, tone and boundaries.

No. of Classes

1 - (Time : 1 hour 30 minutes, Laptops/desktops : 10, Students strength : 15 to 20).

Materials Required

Laptop / Desktop with Internet connections / Wi-Fi.

Prior knowledge
  • Basic usage of WebLLM Module
  • Familiarity with LLMs
Exercises

Exercise (1)



  • Send the same user question with three different system prompts (a pirate, a maths tutor, a five-year-old) and compare the replies. Discuss how the system prompt sets behaviour without the user seeing it.

Exercise (2)



  • Write a system prompt for a character of your choice.

Solutions



Teacher's Instruction:
  1. Explain that LLMs organize conversations using message roles: system (hidden rules/persona), user (human input), and assistant (AI output).
  2. Guide Exercise 1 by showing how changing the system prompt alters tone, vocabulary, and response style while keeping the user query identical.
  3. Encourage creativity in Exercise 2, helping students write specific system boundaries (e.g., "Answer only using emojis" or "Act like a helpful detective").